﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Register.aspx.cs" Inherits="MeetingMinutesManager.Register" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>New User</title>
    <style type="text/css">
        .style1
        {
            width: 77%;
        }
        .style2
        {
            width: 193px;
            text-align: right;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <table class="style1">
            <tr>
                <td class="style2">
                    User Name (Domain Account):</td>
                <td>
                    <asp:TextBox ID="txtUserName" runat="server" Width="200px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    Password:</td>
                <td>
                    <asp:TextBox ID="txtPassword" runat="server" TextMode="Password" Width="200px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    Confirm Password:</td>
                <td>
                    <asp:TextBox ID="txtPasswordConfirm" runat="server" TextMode="Password" 
                        Width="200px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    Email:</td>
                <td>
                    <asp:TextBox ID="txtEmail" runat="server" Width="200px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    Team:</td>
                <td>
                    <asp:DropDownList ID="ddlTeams" runat="server" 
                        DataSourceID="SqlDataSourceTeams" DataTextField="team" DataValueField="id" 
                        Width="200px">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSourceTeams" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:LocalConnectionString %>" 
                        ProviderName="<%$ ConnectionStrings:LocalConnectionString.ProviderName %>" 
                        SelectCommand="SELECT [team], [id] FROM [team] ORDER BY [team]">
                    </asp:SqlDataSource>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    Role:</td>
                <td>
                    <asp:DropDownList ID="ddlRoles" runat="server" 
                        DataSourceID="SqlDataSourceRoles" DataTextField="role" DataValueField="srtseq" 
                        Width="200px">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSourceRoles" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:LocalConnectionString %>" 
                        ProviderName="<%$ ConnectionStrings:LocalConnectionString.ProviderName %>" 
                        SelectCommand="SELECT [role], [id], [srtseq] FROM [role] ORDER BY [srtseq]">
                    </asp:SqlDataSource>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    Manager:</td>
                <td>
                    <asp:DropDownList ID="ddlManager" runat="server" 
                        DataSourceID="SqlDataSourceManagers" DataTextField="usr_name" DataValueField="id" 
                        Width="200px">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSourceManagers" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:LocalConnectionString %>" 
                        ProviderName="<%$ ConnectionStrings:LocalConnectionString.ProviderName %>" 
                        SelectCommand="SELECT [usr_name], [id] FROM [usr] where role &gt;= 50">
                    </asp:SqlDataSource>
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:LocalConnectionString %>" 
                        ProviderName="<%$ ConnectionStrings:LocalConnectionString.ProviderName %>" 
                        SelectCommand="SELECT [role], [id], [srtseq] FROM [role] ORDER BY [srtseq]">
                    </asp:SqlDataSource>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    <asp:Button ID="btnAdd" runat="server" onclick="btnAdd_Click" 
                        Text="Add New User" />
                </td>
                <td>
                    <asp:Button ID="btnLogin" runat="server" onclick="btnLogin_Click" 
                        Text="Login" />
                    <asp:Button ID="btnClean" runat="server" onclick="btnClean_Click" 
                        Text="Clean" />
                </td>
            </tr>
        </table>
    
    </div>
    <asp:SqlDataSource ID="SqlDataSourceUsers" runat="server" 
        ConnectionString="<%$ ConnectionStrings:LocalConnectionString %>" 
        DeleteCommand="DELETE FROM [usr] WHERE [id] = ?" 
        InsertCommand="INSERT INTO [usr] ([usr_name], [password], [team], [email], [mgr_id], [role], [id]) VALUES (?, ?, ?, ?, ?, ?, ?)" 
        ProviderName="<%$ ConnectionStrings:LocalConnectionString.ProviderName %>" 
        SelectCommand="SELECT [usr_name], [password], [team], [email], [mgr_id], [role], [id] FROM [usr] ORDER BY [team], [usr_name]" 
        UpdateCommand="UPDATE [usr] SET [usr_name] = ?, [password] = ?, [team] = ?, [email] = ?, [mgr_id] = ?, [role] = ? WHERE [id] = ?">
        <DeleteParameters>
            <asp:Parameter Name="id" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="usr_name" Type="String" />
            <asp:Parameter Name="password" Type="String" />
            <asp:Parameter Name="team" Type="Int32" />
            <asp:Parameter Name="email" Type="String" />
            <asp:Parameter Name="mgr_id" Type="Int32" />
            <asp:Parameter Name="role" Type="Int32" />
            <asp:Parameter Name="id" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="usr_name" Type="String" />
            <asp:Parameter Name="password" Type="String" />
            <asp:Parameter Name="team" Type="Int32" />
            <asp:Parameter Name="email" Type="String" />
            <asp:Parameter Name="mgr_id" Type="Int32" />
            <asp:Parameter Name="role" Type="Int32" />
            <asp:Parameter Name="id" Type="Int32" />
        </InsertParameters>
    </asp:SqlDataSource>
    </form>
</body>
</html>
